package com.wesh.home.service.impl;

import com.wesh.home.dao.es.SearchRepository;
import com.wesh.home.model.Tender;
import com.wesh.home.service.SearchService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class SearchServiceImpl implements SearchService {

    @Resource
    SearchRepository searchRepository;


    @Override
    public Page<Tender> search(String keyword, int page, int size) {
        return searchRepository.findByProductName(keyword, PageRequest.of(page, size));
    }
}
